package com.taobao.txc.resourcemanager.a.b;

import com.taobao.txc.common.LoggerInit;
import com.taobao.txc.common.LoggerWrap;
import com.taobao.txc.parser.struct.TxcRuntimeContext;
import com.taobao.txc.parser.struct.TxcTable;
import com.taobao.txc.resourcemanager.a.e;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

public class a<T>
  extends com.taobao.txc.resourcemanager.a.a<T>
{
  private static final LoggerWrap b = LoggerInit.logger;
  
  public a(com.taobao.txc.resourcemanager.b.a.a parama, com.taobao.txc.resourcemanager.b.a.d paramd, com.taobao.txc.resourcemanager.b.b.a.a<T> parama1, com.taobao.txc.parser.b.a.g paramg)
  {
    super(parama, paramd, parama1, paramg);
  }
  
  public T b(Object... paramVarArgs)
  {
    com.taobao.txc.parser.b.a.g localg = c();
    com.taobao.txc.resourcemanager.b.a.a locala = a();
    com.taobao.txc.resourcemanager.b.a.d locald = b();
    com.taobao.txc.resourcemanager.b.b.a.a locala1 = d();
    Object localObject = locala1.b(0);
    Statement localStatement = locald.f();
    TxcRuntimeContext localTxcRuntimeContext = locala.c();
    localg.c().a();
    localg.d().a();
    if (b.b()) {
      com.taobao.txc.common.a.a.a().c();
    }
    String str = null;
    switch (b.a[localg.j().d().ordinal()])
    {
    case 1: 
      localg.b(locald);
      if (b.b()) {
        localTxcRuntimeContext.a(com.taobao.txc.common.a.a.a().c());
      }
      localObject = locala1.b(localStatement, paramVarArgs);
      if (b.b()) {
        localTxcRuntimeContext.c(com.taobao.txc.common.a.a.a().c());
      }
      localg.c(locald);
      if (b.b()) {
        localTxcRuntimeContext.b(com.taobao.txc.common.a.a.a().c());
      }
      str = locala.a(localg.d());
      break;
    case 2: 
    case 3: 
      localg.b(locald);
      if (localg.c().b() != 0)
      {
        if (b.b()) {
          localTxcRuntimeContext.a(com.taobao.txc.common.a.a.a().c());
        }
        localObject = locala1.b(localStatement, paramVarArgs);
        if (b.b()) {
          localTxcRuntimeContext.c(com.taobao.txc.common.a.a.a().c());
        }
        localg.c(locald);
        if (b.b()) {
          localTxcRuntimeContext.b(com.taobao.txc.common.a.a.a().c());
        }
        str = locala.a(localg.c());
      }
      break;
    default: 
      throw new SQLException("unsupported sqltype:" + localg.j().d().a());
    }
    localTxcRuntimeContext.c(str);
    localTxcRuntimeContext.a(localg);
    return localObject;
  }
  
  public T c(Object... paramVarArgs)
  {
    com.taobao.txc.parser.b.a.g localg = c();
    com.taobao.txc.resourcemanager.b.a.a locala = a();
    com.taobao.txc.resourcemanager.b.a.d locald = b();
    com.taobao.txc.resourcemanager.b.b.a.a locala1 = d();
    Object localObject1 = locala1.b(0);
    e locale = new e();
    Connection localConnection = locala.b();
    Statement localStatement = locald.f();
    TxcRuntimeContext localTxcRuntimeContext = locala.c();
    try
    {
      for (;;)
      {
        try
        {
          locala.setAutoCommit(false);
          localg.c().a();
          localg.d().a();
          if (b.b())
          {
            localTxcRuntimeContext.a(0L).c(0L).b(0L);
            com.taobao.txc.common.a.a.a().c();
          }
          String str = null;
          switch (b.a[localg.j().d().ordinal()])
          {
          case 1: 
            localg.b(locald);
            if (b.b()) {
              localTxcRuntimeContext.a(com.taobao.txc.common.a.a.a().c());
            }
            localObject1 = locala1.b(localStatement, paramVarArgs);
            if (b.b()) {
              localTxcRuntimeContext.c(com.taobao.txc.common.a.a.a().c());
            }
            localg.c(locald);
            if (b.b()) {
              localTxcRuntimeContext.b(com.taobao.txc.common.a.a.a().c());
            }
            str = locala.a(localg.d());
            locala.b(str);
            break;
          case 2: 
          case 3: 
            localg.b(locald);
            if (localg.c().b() != 0)
            {
              if (b.b()) {
                localTxcRuntimeContext.a(com.taobao.txc.common.a.a.a().c());
              }
              localObject1 = locala1.b(localStatement, paramVarArgs);
              if (b.b()) {
                localTxcRuntimeContext.c(com.taobao.txc.common.a.a.a().c());
              }
              TxcTable localTxcTable = localg.c(locald);
              if (b.b()) {
                localTxcRuntimeContext.b(com.taobao.txc.common.a.a.a().c());
              }
              if (localTxcTable == null)
              {
                locala.b(null);
              }
              else
              {
                str = locala.a(localg.c());
                locala.b(str);
              }
            }
            break;
          default: 
            throw new SQLException("unsupported sqltype:" + localg.j().d().a());
          }
        }
        catch (com.taobao.txc.common.b.d locald1)
        {
          localConnection.rollback();
          locale.a(locald1);
        }
      }
      localTxcRuntimeContext.a(localg);
      locala.commit();
    }
    catch (Throwable localThrowable)
    {
      locala.rollback();
      throw new SQLException(localThrowable);
    }
    finally
    {
      locala.setAutoCommit(true);
    }
    return localObject1;
  }
  
  public T a(Object... paramVarArgs)
  {
    String str = c().j().b();
    if (a == null)
    {
      if (("sequence".compareToIgnoreCase(str) == 0) || ("sequence_opt".compareToIgnoreCase(str) == 0) || (str.toLowerCase().startsWith("sequence_opt_mem_"))) {
        return d().b(b().f(), paramVarArgs);
      }
    }
    else if (com.taobao.txc.common.util.c.g.c(str.toLowerCase(), a.toLowerCase())) {
      return d().b(b().f(), paramVarArgs);
    }
    if (a().getAutoCommit() == true) {
      return c(paramVarArgs);
    }
    return b(paramVarArgs);
  }
}


/* Location:           C:\Users\ibm\Downloads\txc-yun-sample (1)\txc-yun-sample\lib\txc-client-2.0.72.jar
 * Qualified Name:     com.taobao.txc.resourcemanager.a.b.a
 * JD-Core Version:    0.7.0.1
 */